﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="Entity.cs" company="DissingNellemann">
//   
// All rights reserved </copyright>
// <summary>
//   The entity.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Website.Models.Base
{
    using System;

    /// <summary>
    ///     The entity.
    /// </summary>
    public class Entity
    {
        #region Public Properties

        /// <summary>
        ///     Gets or sets the ID of the Entity.
        /// </summary>
        public Guid ID { get; set; }

        /// <summary>
        ///     Gets or sets the version.
        /// </summary>
        public int Version { get; set; }

        #endregion

        #region Public Methods and Operators

        /// <summary>
        /// The equals.
        /// </summary>
        /// <param name="obj">
        /// The obj.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public override bool Equals(object obj)
        {
            var et = obj as Entity;

            if (et == null)
            {
                return false;
            }

            return this.ID.Equals(et.ID);
        }

        /// <summary>
        ///     The get hash code.
        /// </summary>
        /// <returns>
        ///     The <see cref="int" />.
        /// </returns>
        public override int GetHashCode()
        {
            return this.ID.GetHashCode();
        }

        #endregion
    }
}